package fr.u.psud.polytech.database;   
import org.hibernate.SessionFactory; 
import org.hibernate.cfg.Configuration;   

public class HibernateUtil {  
	private static final SessionFactory sessionFactory = buildSessionFactory();  
	private static SessionFactory buildSessionFactory() {   
		try {    
			// Cr�er la SessionFactory d�clar�e dans hibernate.cfg.xml    
			return new Configuration().configure().buildSessionFactory();   
		}   
		catch (Throwable ex) {    
			// S'assurer de logger les exceptions    
			System.err.println("Initial SessionFactory creation failed." + ex);    
			throw new ExceptionInInitializerError(ex);   
		}  
	}  
	public static SessionFactory getSessionFactory() {   
		return sessionFactory;  
	} 
}